package com.example.fszq.volleydemo1;

import android.app.Application;

import com.android.volley.RequestQueue;
import com.example.fszq.volleydemo1.utils.MyUtil;
import com.example.fszq.volleydemo1.utils.Requesttoserver;
import com.qiniu.android.storage.UploadManager;

/**
 * Created by fszq on 2015/12/17.
 */
public class CatImgController extends Application {
    public static final  String TAG = CatImgController.class.getSimpleName();
    private RequestQueue quence ;
    private Requesttoserver Rserver = new Requesttoserver();
    //private ImageLoader mImageLoader;
    private static CatImgController mInstance;
    private String forumHtmlCssStr = null;
    private String forumDivCssStr = null;
    private String forumContentStr = null;
    private String forumHeaderStr = null;
    private UploadManager uploadManager;

    //一些通用类
    private MyUtil myUtil;

    @Override
    public void onCreate() {
        super.onCreate();
        mInstance = this;

        myUtil = new MyUtil(CatImgController.mInstance);

        //读取css文件
        forumHtmlCssStr = myUtil.readAssetsFile("forumstyle.txt");

        //读取div样式文件
        forumDivCssStr = myUtil.readAssetsFile("forumdiv.txt");

        //读取内容头文件
        forumContentStr = myUtil.readAssetsFile("forumcontent.txt");

        //读取标题头文件
        forumHeaderStr = myUtil.readAssetsFile("forumheader.txt");

        //初始化imageloader
        /*ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
                .threadPriority(Thread.NORM_PRIORITY - 2).denyCacheImageMultipleSizesInMemory()
                .diskCacheFileNameGenerator(new Md5FileNameGenerator()).diskCacheSize(10 * 1024 * 1024)
                .diskCacheFileCount(100).tasksProcessingOrder(QueueProcessingType.LIFO).build();
        ImageLoader.getInstance().init(config);*/

    }

    public static synchronized CatImgController getmInstance() {
        return mInstance;
    }

    /*public ImageLoader getImageLoader() {
        quence = Rserver.getRequestQueue(getApplicationContext());

        if (mImageLoader == null) {
            mImageLoader = new ImageLoader(quence,
                    new BitmapCache());
        }
        return this.mImageLoader;
    }*/

    //读取文件头
    public String getHtmlCss() {
        return  this.forumHtmlCssStr;

    }

    public String getForumDivCssStr() {
        return  this.forumDivCssStr;
    }

    public String getForumContentStr() {
        return  this.forumContentStr;
    }

    public String getForumHeaderStr() {
        return  this.forumHeaderStr;
    }

    //private String readFile(String fileName) {
    //    return
    //}

}
